package com.jn.factory.simplefactory.pizzastore.order;

import com.jn.factory.simplefactory.pizzastore.pizza.CheesePizza;
import com.jn.factory.simplefactory.pizzastore.pizza.GreekPizza;
import com.jn.factory.simplefactory.pizzastore.pizza.PepperPizza;
import com.jn.factory.simplefactory.pizzastore.pizza.Pizza;

/**
 * @author 江南大学1033190417
 * @date 2022/4/10 19:13
 */

//简单工厂类
public class SimpleFactory {

    public Pizza createPizza(String orderType){
        Pizza pizza=null;
        if (orderType.equals("greek")) {
            pizza = new GreekPizza();
            pizza.setName(" 希腊披萨 ");
        } else if (orderType.equals("cheese")) {
            pizza = new CheesePizza();
            pizza.setName(" 奶酪披萨 ");
        }else if (orderType.equals("胡椒披萨")){
            pizza=new PepperPizza();
            pizza.setName("胡椒pisa");
        }
        return pizza;
    }
}
